//
//  LeftMenuCell.m
//  YouthOlympic2014
//
//  Created by xiangpaopao on 14-6-19.
//  Copyright (c) 2014年 mitian. All rights reserved.
//

#define cellTitleColor Rgb2UIColor(153, 153, 153)

#import "LeftMenuCell.h"

@interface LeftMenuCell ()

@property UIColor* highColor;
@property NSString* iconName;
@property NSString* iconHighName;


@end

@implementation LeftMenuCell



- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        // Initialization code
    }
    return self;
}

- (void)awakeFromNib
{
    // Initialization code
}

-(void)configureWithImgName:(NSString *)name
                      title:(NSString*)title
                  highColor:(UIColor*) color
{
    
    _highColor = color;
    _iconName = name;
    _iconHighName = [NSString stringWithFormat:@"%@_on",name];

    [self.titleLabel setText:title];
    [self.iconView setImage:[UIImage imageNamed:_iconName]];
    [self.contentView setBackgroundColor:[UIColor clearColor]];
    
    self.selectedBackgroundView = [[UIView alloc] initWithFrame:self.frame];
    self.selectedBackgroundView.backgroundColor = Rgb2UIColor(40, 83, 73);
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];
    
    if (selected) {
        [self.titleLabel setTextColor:_highColor];
        [self.iconView setImage:[UIImage imageNamed:_iconHighName]];
    }else{
        [self.titleLabel setTextColor:cellTitleColor];
        [self.iconView setImage:[UIImage imageNamed:_iconName]];
    }
    
}



@end
